[id].vue 17 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548
  1. <template>
  2. <div id="newsList">
  3. <!-- 页面头部 -->
  4. <HomePageHead></HomePageHead>
  5. <!-- Banner1 -->
  6. <HomeBanner1></HomeBanner1>
  7. <!-- 面包屑导航 -->
  8. <div class="breadcrumb">
  9. <div class="inner">
  10. <span class="location">当前位置:</span>
  11. <el-breadcrumb :separator-icon="ArrowRight">
  12. <el-breadcrumb-item :to="{ path: '/' }">首页</el-breadcrumb-item>
  13. <el-breadcrumb-item :to="{ path: '/primaryNavigation/newsList' }">三农之窗</el-breadcrumb-item>
  14. </el-breadcrumb>
  15. </div>
  16. </div>
  17. <!-- 资讯列表 -->
  18. <div class="newsList">
  19. <div class="inner">
  20. <div class="innerLeft">
  21. <ul class="list">
  22. <li v-for="(item, index) in newsList" :key="index">
  23. <!-- <NuxtLink to="/primaryNavigation/newsDetail/newsDetail">{{ item }}</NuxtLink> -->
  24. <NuxtLink to="/primaryNavigation/newsDetail/newsDetail">{{ item.title }}</NuxtLink>
  25. </li>
  26. </ul>
  27. <!-- 分页器 -->
  28. <div class="pagination">
  29. <HomePagination @sendData="handleData"></HomePagination>
  30. </div>
  31. </div>
  32. <div class="innerRight">
  33. <DetailHotNews></DetailHotNews>
  34. </div>
  35. </div>
  36. </div>
  37. <!-- 三农资讯logo -->
  38. <HomeSannongzixun></HomeSannongzixun>
  39. <!-- 资讯推荐 -->
  40. <div class="zixuntuijian">
  41. <div class="inner">
  42. <div class="innerLeft">
  43. <div class="zixunLeft">
  44. <!-- 标题部分 -->
  45. <div class="title">
  46. <h3>
  47. 资讯推荐
  48. <span>查看更多</span>
  49. </h3>
  50. </div>
  51. <!-- 图片和文字列表 -->
  52. <ul class="photo_text">
  53. <li>
  54. <img src="../../static/images/tonny00255_On(1).png" alt="">
  55. <div>
  56. <h5>高邮市周山镇开展渔业安全生产应急</h5>
  57. <p>
  58. <span>王某某</span>
  59. <span>2024-8-6</span>
  60. </p>
  61. </div>
  62. </li>
  63. <li v-for="item in 3">
  64. <em></em>
  65. 高邮市周山镇开展渔业安全生产应急
  66. </li>
  67. </ul>
  68. </div>
  69. <div class="zixunRight">
  70. <!-- 标题部分 -->
  71. <div class="title">
  72. <h3>
  73. 资讯推荐
  74. <span>查看更多</span>
  75. </h3>
  76. </div>
  77. <!-- 图片和文字列表 -->
  78. <ul class="photo_text">
  79. <li>
  80. <img src="../../static/images/tonny00255_On(1).png" alt="">
  81. <div>
  82. <h5>高邮市周山镇开展渔业安全生产应急</h5>
  83. <p>
  84. <span>王某某</span>
  85. <span>2024-8-6</span>
  86. </p>
  87. </div>
  88. </li>
  89. <li v-for="item in 3">
  90. <em></em>
  91. 高邮市周山镇开展渔业安全生产应急
  92. </li>
  93. </ul>
  94. </div>
  95. </div>
  96. <div class="innerRight">
  97. <!-- 标题部分 -->
  98. <div class="title">
  99. <h4>
  100. 热点资讯
  101. <span>查看更多</span>
  102. </h4>
  103. </div>
  104. <!-- 列表 -->
  105. <ul class="rightList">
  106. <li v-for="item in 2">
  107. <img class="left"
  108. src="../../static/images/sgbhsihfgisdfaasda45632113_A_group_of_Chinese_farmers_are_trans_0e341355-f4d5-4796-b6cd-bdc87996f81b(1).png"
  109. alt="">
  110. <p class="left">高邮市周山镇开展渔业安全生产应急演练</p>
  111. </li>
  112. </ul>
  113. </div>
  114. </div>
  115. </div>
  116. <!-- 页面底部 -->
  117. <HomeFoot></HomeFoot>
  118. </div>
  119. </template>
  120. <script setup>
  121. import { onMounted } from 'vue';
  122. import { ElBreadcrumb, ElBreadcrumbItem } from 'element-plus'
  123. import { ArrowRight } from '@element-plus/icons-vue'
  124. // let newsList = [
  125. // '稳经济政策正朝着“稳健有效”持续发力',
  126. // '布上青花 指尖非遗——千年蜡染的传承与创新',
  127. // '拉萨市涉建筑垃圾、城市建设两部条例将于11月1日实施',
  128. // '中国稳定股市新工具启动 5000亿规模只能投资股市',
  129. // '国家数据局:建立健全公共数据产品和服务价格形成机制',
  130. // '第十二届全国少数民族传统体育运动会启动火炬传递',
  131. // '网信部门曝光“毒视频”“开盒挂人”等涉未成年人乱象',
  132. // '辅警执勤时被闯红灯超速摩托车撞倒 浙江义乌警方通报',
  133. // '接地气、心贴心 各地创新宣讲形式把全会精神送到干部群众身边',
  134. // '美军火商对台军售涉抬价诈欺,台当局替美辩称“美国也是受害...'
  135. // ]
  136. const nuxtApp = useNuxtApp();
  137. const axios = nuxtApp.$axios;
  138. //关键词
  139. let keyWord = useState("keyWord", () => "")
  140. const route = useRoute();
  141. keyWord.value = route.query.keyword;
  142. // 页码
  143. let page = useState("page", () => 1)
  144. //页面组件传递数据的时间驱动函数
  145. const handleData = (data) => {
  146. console.log(data.value)
  147. page.value=data.value
  148. //在页码发生变化时去请求响应页面的新闻数据
  149. axios.get(`/web/getWebsiteArticlesList?page=${page.value}&pageSize=${10}&catid=${14}&keyword=${keyWord.value}`).then(response=>{
  150. // console.log(response.data.rows);
  151. newsList.value = response.data.rows;
  152. }).catch(error => {
  153. console.error(error);
  154. })
  155. }
  156. // 新闻列表
  157. const newsList = useState("newsList", () => '');
  158. const newslists = async () => {
  159. try {
  160. const response = await axios.get(`/web/getWebsiteArticlesList?page=${1}&pageSize=${10}&catid=${14}&keyword=${keyWord.value}`);
  161. // console.log(response.data.rows);
  162. newsList.value = response.data.rows;
  163. } catch (error) {
  164. console.error(error);
  165. }
  166. }
  167. //挂载成功钩子函数
  168. onMounted(() => {
  169. newslists()
  170. })
  171. //路由中间件
  172. definePageMeta({
  173. middleware:'auth'
  174. })
  175. </script>
  176. <style lang="less" scoped>
  177. //导航条
  178. .breadcrumb {
  179. width: 100%;
  180. height: 22px;
  181. margin-bottom: 30px;
  182. font-family: Microsoft YaHei, Microsoft YaHei;
  183. font-weight: 400;
  184. font-size: 20px;
  185. color: #666666;
  186. line-height: 23px;
  187. text-align: left;
  188. font-style: normal;
  189. text-transform: none;
  190. /deep/.el-breadcrumb {
  191. display: inline-block;
  192. vertical-align: -4px;
  193. }
  194. /deep/.el-breadcrumb__inner a,
  195. /deep/.el-breadcrumb__inner.is-link {
  196. color: #666666;
  197. font-weight: 400;
  198. text-decoration: none;
  199. transition: var(--el-transition-color);
  200. }
  201. span {
  202. font-family: Microsoft YaHei, Microsoft YaHei;
  203. font-weight: 400;
  204. font-size: 20px;
  205. color: #666666;
  206. line-height: 23px;
  207. text-align: left;
  208. font-style: normal;
  209. text-transform: none;
  210. }
  211. span:hover {
  212. color: #666666;
  213. }
  214. .location {
  215. margin-right: 20px;
  216. width: 100px;
  217. height: 22px;
  218. font-family: Microsoft YaHei, Microsoft YaHei;
  219. font-weight: 400;
  220. font-size: 20px;
  221. color: #666666;
  222. line-height: 23px;
  223. text-align: left;
  224. font-style: normal;
  225. text-transform: none;
  226. }
  227. }
  228. // 资讯列表
  229. .newsList {
  230. width: 100%;
  231. height: 675px;
  232. margin-bottom: 70px;
  233. .inner {
  234. width: 1200px;
  235. .innerLeft,
  236. .innerRight {
  237. border-top: 1px solid #139602;
  238. }
  239. .innerLeft {
  240. height: 675px;
  241. >.list {
  242. height: 570px;
  243. margin-bottom: 70px;
  244. >li {
  245. width: 790px;
  246. height: 56px;
  247. line-height: 56px;
  248. border-bottom: 1px solid #D9D9D9;
  249. >a {
  250. width: 360px;
  251. height: 26px;
  252. font-family: Microsoft YaHei, Microsoft YaHei;
  253. font-weight: 400;
  254. font-size: 20px;
  255. color: #333333;
  256. line-height: 26px;
  257. text-align: left;
  258. font-style: normal;
  259. text-transform: none;
  260. }
  261. }
  262. >li:hover>a {
  263. color: #139602;
  264. }
  265. >li:nth-child(1)::after,
  266. >li:nth-child(2)::after {
  267. content: "热";
  268. margin-left: 13px;
  269. background: #FF8A37;
  270. color: #fff;
  271. font-size: 14px;
  272. padding: 0px 2px;
  273. }
  274. }
  275. >.pagination {
  276. width: 790px;
  277. height: 34px;
  278. margin-left: 141px;
  279. }
  280. }
  281. .innerRight {
  282. width: 381px;
  283. height: 605px;
  284. }
  285. }
  286. }
  287. //资讯推荐
  288. .zixuntuijian {
  289. width: 100%;
  290. height: 290px;
  291. margin-bottom: 70px;
  292. .innerLeft {
  293. // 左侧
  294. .zixunLeft {
  295. margin-right: 30px;
  296. }
  297. .zixunRight,
  298. .zixunLeft {
  299. float: left;
  300. width: 380px;
  301. height: 290px;
  302. // 标题部分
  303. >.title {
  304. width: 380px;
  305. }
  306. >.title>h3 {
  307. height: 36px;
  308. font-family: Source Han Sans, Source Han Sans;
  309. font-weight: bold;
  310. font-size: 24px;
  311. color: #000000;
  312. line-height: 28px;
  313. text-align: left;
  314. font-style: normal;
  315. text-transform: none;
  316. border-bottom: 1px solid #139602;
  317. }
  318. >.title>h3>span {
  319. float: right;
  320. width: 56px;
  321. height: 20px;
  322. line-height: 24px;
  323. font-weight: 400;
  324. font-size: 14px;
  325. color: #999999;
  326. font-style: normal;
  327. text-transform: none;
  328. }
  329. .photo_text {
  330. >li:first-child {
  331. width: 380px;
  332. height: 120px;
  333. margin-top: 20px;
  334. margin-bottom: 15px;
  335. position: relative;
  336. >img {
  337. float: left;
  338. width: 160px;
  339. height: 120px;
  340. }
  341. >div {
  342. float: left;
  343. width: 220px;
  344. height: 120px;
  345. padding-left: 15px;
  346. padding-top: 6px;
  347. box-sizing: border-box;
  348. background-color: #f6f6f6;
  349. >h5 {
  350. height: 54px;
  351. font-family: Source Han Sans, Source Han Sans;
  352. font-weight: 500;
  353. font-size: 18px;
  354. color: #333333;
  355. line-height: 26px;
  356. text-align: left;
  357. font-style: normal;
  358. text-transform: none;
  359. }
  360. >p {
  361. width: 200px;
  362. height: 22px;
  363. line-height: 20px;
  364. position: absolute;
  365. bottom: 5px;
  366. right: 0;
  367. >span {
  368. display: inline-block;
  369. width: 100px;
  370. height: 18px;
  371. font-family: Source Han Sans, Source Han Sans;
  372. font-weight: 400;
  373. font-size: 12px;
  374. color: #999999;
  375. text-align: left;
  376. line-height: 14px;
  377. font-style: normal;
  378. text-transform: none;
  379. }
  380. >span:last-child {
  381. width: 90px;
  382. text-align: right;
  383. }
  384. }
  385. }
  386. }
  387. >li {
  388. width: 380px;
  389. height: 25px;
  390. font-family: PingFang SC, PingFang SC;
  391. font-weight: 500;
  392. font-size: 18px;
  393. color: #333333;
  394. line-height: 21px;
  395. text-align: left;
  396. font-style: normal;
  397. text-transform: none;
  398. margin-bottom: 10px;
  399. em {
  400. display: inline-block;
  401. width: 8px;
  402. height: 8px;
  403. border-radius: 8px;
  404. margin-right: 10px;
  405. background-color: #d9d9d9;
  406. }
  407. }
  408. >li:hover {
  409. color: #139602;
  410. }
  411. >li:hover em {
  412. background-color: #139602;
  413. }
  414. }
  415. }
  416. }
  417. .innerRight {
  418. width: 381px;
  419. height: 290px;
  420. background-color: #fbfbfb;
  421. >.title {
  422. width: 380px;
  423. height: 40px;
  424. line-height: 40px;
  425. border-top: 1px solid #139602;
  426. border-bottom: 1px solid #e7e7e7;
  427. >h4 {
  428. font-family: Microsoft YaHei, Microsoft YaHei;
  429. font-weight: 400;
  430. margin-left: 20px;
  431. font-size: 20px;
  432. color: #000000;
  433. text-align: left;
  434. font-style: normal;
  435. text-transform: none;
  436. >span {
  437. float: right;
  438. font-family: Microsoft YaHei, Microsoft YaHei;
  439. font-weight: 400;
  440. font-size: 14px;
  441. margin-right: 10px;
  442. color: #999999;
  443. text-align: left;
  444. font-style: normal;
  445. text-transform: none;
  446. }
  447. }
  448. }
  449. .rightList {
  450. height: 540px;
  451. margin-top: 20px;
  452. >li {
  453. height: 100px;
  454. margin-bottom: 10px;
  455. >img {
  456. width: 150px;
  457. height: 100px;
  458. }
  459. >p {
  460. width: 219px;
  461. height: 100px;
  462. padding-left: 12px;
  463. font-family: PingFang SC, PingFang SC;
  464. font-weight: 400;
  465. font-size: 16px;
  466. color: #333333;
  467. line-height: 22px;
  468. text-align: left;
  469. font-style: normal;
  470. text-transform: none;
  471. }
  472. >p:hover {
  473. box-shadow: 0 0 16px 1px rgba(0, 0, 0, 0.1);
  474. }
  475. }
  476. }
  477. }
  478. }
  479. </style>